/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package webservice;

import VO.Constants;
import VO.TransactionVO;
import service.TransactionService;
import java.util.ArrayList;
import java.util.List;
import javax.jws.WebService;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.ejb.Stateless;
import javax.jws.Oneway;

/**
 *
 * @author julianDavidPG
 */
@WebService(serviceName = "Reports")
@Stateless()
public class Reports {

    /**
     * Web service operation
     * 
     * This method returns the types of report
     * the module can process
     * @return ArrayList<String>
     */
    @WebMethod(operationName = "getReportTypes")
    public java.util.ArrayList<String> getReportTypes() {
        ArrayList<String> list = new ArrayList<String>();
        list.add(Constants.typeValidTransaction);
        list.add(Constants.typeInvalidTransaction);
        list.add(Constants.typeAmount);
        return list;
    }

    /**
     * Web service operation
     * 
     * This method return a list of transactions that meet
     * the criteria given
     * @return List<Transaction>
     */
    @WebMethod(operationName = "getTransactions")
    public List<TransactionVO> getTransactions(@WebParam(name = "initialDate") String initialDate, 
                                        @WebParam(name = "finalDate") String finalDate, 
                                        @WebParam(name = "establishmentID") String establishmentID, 
                                        @WebParam(name = "brandID") String brandID, 
                                        @WebParam(name = "franchiseID") String franchiseID, 
                                        @WebParam(name = "reportType") String reportType, 
                                        @WebParam(name = "initAmount") double initAmount,
                                        @WebParam(name = "finAmount") double finAmount) {
        TransactionService service = new TransactionService();
        
        return service.getTransactions(initialDate, finalDate, establishmentID, brandID, franchiseID, reportType, (long)initAmount, (long)finAmount);
    }

    /**
     * Web service operation
     */
    @WebMethod(operationName = "fillMongo")
    @Oneway
    public void fillMongo() {
        TransactionService service = new TransactionService();
        service.fillMongo();
    }
}
